home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Documentation / Engineering Notes / Embedding an OpenDoc File next >
Encoding:
Text File  |  1996-09-18  |  2.1 KB  |  56 lines  |  [TEXT/ttxt]

  1. OpenDoc
  2. Development
  3. Framework
  4.                                                                                                                                                                                     
  5. Embedding an OpenDoc File
  6. ODF Release  2                                                                                                                                                           
  7.  
  8.  
  9. In the case where your part editor needs to embed another OpenDoc document or stationery without intervention by the user, ODF provides the function FW_ClonePartFromFile.  This function, located in the file FWEmdUtl.cpp, allows you to clone a part from a document or stationery. Your code should look something like the following:
  10.  
  11. void CMyFrame::EmbedOpenDocFile(Environment* ev, const FW_PFileSpecification& fileSpec)
  12. {
  13.      // Call FW_ClonePartFromFile
  14.         FW_CAcquiredODPart embeddedPart = FW_ClonePartFromFile(ev, this, fileSpec);
  15.         
  16.         // Create the proxy
  17.         CMyProxy* proxy = FW_NEW(CMyProxy, (ev, .....));    
  18.         
  19.   // Create the frame shape
  20.         FW_CRect tempRect(FW_kFixed0, FW_kFixed0, FW_IntToFixed(100),  FW_IntToFixed(100));
  21.         FW_CAcquiredODShape aqFrameShape = ::FW_NewODShape(ev, tempRect);
  22.  
  23.         // Call FW_CPresentation Embed
  24.         FW_TRY
  25.         {
  26.              proxy->Embed(ev, 
  27.                                                                             GetPresentation(ev),
  28.                                                                             embeddedPart,
  29.                                                                             NULL,
  30.                                                                             kODFrameObject,
  31.                                                                             aqFrameShape,
  32.                                                                             FW_CPart::gViewAsFrameToken,
  33.                                                                             NULL,
  34.                                                                             0,
  35.                                                                             FALSE,
  36.                                                                             FALSE);
  37.         }
  38.         FW_CATCH_BEGIN
  39.         FW_CATCH_EVERYTHING () 
  40.         {
  41.             delete proxy;
  42.             FW_THROW_SAME ();
  43.         }
  44.         FW_CATCH_END
  45.         
  46.         // At this point you can add the proxy object to your content
  47.      ....
  48.         
  49.   // Don't forget also to clip the embedded facets
  50.         FW_CFacetClipper facetClipper(fMyPart);
  51.         facetClipper.Clip(ev, GetPresentation(ev), aqFrameShape);
  52. }
  53.  
  54.  
  55. © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  56. Apple, the Apple Logo, Macintosh, and OpenDoc are trademarks of Apple Computer, Inc., registered in the United States and other countries.